const HB = require("./inc/baseHb");
const STATE = require("../states/gunstates"); 
cc.Class({
    extends: HB,

    properties: {
    },

    onLoad(){
        this.setAttr("_gunStateV" , STATE.INHEBING );
    },

    resetGunpos(){
        if(!this._gun) return;
        this._gun.node.active = true;
        const thispos = this.node.parent.convertToWorldSpaceAR(this.node.getPosition());
        let topos = this._gun.node.parent.convertToNodeSpaceAR(thispos);
        //topos = topos.add(cc.v2(0,10));

        topos = topos.sub(cc.v2( (this._gun.node.width/5)*2 , this._gun.node.height/3.5 ));


        cc.tween( this._gun.node)
        .to(.08 , {x:topos.x , y:topos.y , scale : 1})
        .call(()=>{
            this._gun.flymodel( false );
        })
        .start();

        
        //this._gun.node.setPosition( this._gun.node.parent.convertToNodeSpaceAR(thispos) );
    }

});
